<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
	<meta name="format-detection" content="telephone=no"/>
	<title>新华保险培训微平台</title>
	<link rel="stylesheet" href="../css/lt_common.css">
	<link rel="stylesheet" href="../css/newvideo.css">
	<link rel="stylesheet" href="../css/lt_tab.css">
	<link rel="stylesheet" href="../css/newlesson.css">
	<script src="../js/jquery.js"></script>
	<script src="../js/jquery.lt_tab.js"></script>
	<script src="../js/common.js"></script>
    <script src="../js/teacherclub/publishLesson.js"></script>
</head>
<body>
	<div class="page">
	<form action="" id="publishVideo" enctype="multipart/form-data">
		<div class="title_content">
			<label for=""><input type="text" placeholder="课件名称" name="title"><i class="write"></i></label>
			<label for=""><input type="text" placeholder="课件描述" name="content"><i class="write"></i></label>
			<label for=""><input type="text" placeholder="课件链接" name="url"><i class="write"></i></label>
		</div>
		<div class="choose_content">
			<div class="way_content">
				<h3><i class="label"></i>适用范围（可多选）</h3>
				<ul class="label_content">
					<li><span>新人</span></li>
					<li><span>绩优</span></li>
					<li><span>主管</span></li>
					<li><span>部经理以上</span></li>
					<li class="last_check"><span>讲师/训练师/组督训</span></li>

                    <input type="checkbox" style="display:none;" value="1" name="scopeidsval"/>
                    <input type="checkbox" style="display:none;" value="2" name="scopeidsval"/>
                    <input type="checkbox" style="display:none;" value="3" name="scopeidsval"/>
                    <input type="checkbox" style="display:none;" value="4" name="scopeidsval"/>
                    <input type="checkbox" style="display:none;" value="5" name="scopeidsval"/>
                    <input class="checkOn" type="hidden" name='scopeids' id='scopeids' value="">
				</ul>
			</div>
			<div class="tab">
				<h3><i class="label label_on"></i>课件是否曾经应用过</h3>
				<div class="tab_header">
					<ul>
						<li><a href="javascript:;" class="on"><i class="nocheck"></i>是</a></li>
						<li><a href="javascript:;"><i class="nocheck"></i>否</a></li>
						<input id="tabindex" type="hidden" value="1">
					</ul>
					<div class="clear"></div>
				</div>
				<div class="tab_content_container">
					<div class="tab_content current">
						<div class="attr_content app">
							<h3><i class="first"></i>应用层面</h3>
							<ul class="label_content">
								<li><span>营服</span></li>
								<li><span>中支</span></li>
								<li><span>区域</span></li>
								<li><span>分公司</span></li>
								<li><span>总公司</span></li>
								<input name="usedlevelid" class="ridioIndex" type="hidden" value="">
							</ul>
						</div>
						<div class="attr_content person_way clear">
							<h3><i class="second"></i>受众（可多选）</h3>
							<ul class="label_content">
								<li><span>新人</span></li>
								<li><span>绩优</span></li>
								<li><span>主管</span></li>
								<li><span>部经理以上</span></li>
								<li class="last_check"><span>讲师/训练师/组督训</span></li>

                                <input type="checkbox" style="display:none;" value="1" name="scopeidsvals"/>
                                <input type="checkbox" style="display:none;" value="2" name="scopeidsvals"/>
                                <input type="checkbox" style="display:none;" value="3" name="scopeidsvals"/>
                                <input type="checkbox" style="display:none;" value="4" name="scopeidsvals"/>
                                <input type="checkbox" style="display:none;" value="5" name="scopeidsvals"/>
                                <input class="checkOn" type="hidden" name='audienceids' id='audienceids' value="">
                            </ul>
						</div>
						<div class="attr_content person_num clear">
							<h3><i class="third"></i>参训人数</h3>
							<ul class="label_content">
								<li><span>0-50</span></li>
								<li><span>51-100</span></li>
								<li><span>100-200</span></li>
								<li><span>200以上</span></li>
								<input name="trainingnumberid" class="ridioIndex" type="hidden" value="">
							</ul>
						</div>			
					</div>
					<div class="tab_content">
						暂无
					</div>
				</div>
			</div>	
		</div>
		<div class="i_promise">
			<a href="javascript:;"><i class="nocheck"></i>我承诺此课程为自主研发，已确认无违纪违规内容，若承诺不实，责任自负。
			</a>	
		</div>
		<div class="btn_content">
			<input type="button" value="发布" class="publish_video">
		</div>
	</form>	
	</div>
</body>
</html>
<script type="text/javascript">
    //write by whl
    //适用范围的多选
    var useLis1=$("div.way_content").find("li");
    var checkBox1=$("div.way_content").find("input").not("[class='checkOn']");
    var arr1=[];
    var str1='';
    for(var i=0;i<useLis1.length;i++)
    {
        $(useLis1[i]).on("click",function()
        {
            //alert($(this).index())
            if($(checkBox1.eq($(this).index())).attr("checked")==undefined)
            {
                $(checkBox1.eq($(this).index())).attr("checked",true);
                arr1.push($(checkBox3.eq($(this).index())).val());
            }else{
                $(checkBox1.eq($(this).index())).attr("checked",false);
                for(var j=0;j<arr1.length;j++)
                {
                    if(arr1[j]==$(checkBox3.eq($(this).index())).val())
                    {
                       arr1.splice(j,1);
                    }
                }
            }
			str1=arr1.join(',');
            $('#scopeids').val(str1);
            //alert($('#scopeids').val());
            //$(".checkOn").eq(0).val(1);
            //alert($(".checkOn").eq(0).val())
        })
    }
    //课件是否被用过单选
    $('.tab_header').find('li').eq(1).on('click',function(){
        $('#tabindex').val(0);
        $(".ridioIndex").eq(0).val('');
        $(".checkOn").eq(1).val('');
        $(".ridioIndex").eq(1).val('');
        //alert($('#tabindex').val())  否
    })
    $('.tab_header').find('li').eq(0).on('click',function(){
        $('#tabindex').val(1);
        //alert($('#tabindex').val()) 是
    })
    //受众（可多选）的多选
    var useLis3=$("div.attr_content").eq(1).find("li");
    var checkBox3=$("div.attr_content").eq(1).find("input").not("[class='checkOn']");
    var arr2=[];
    var str='';
    for(var i=0;i<useLis3.length;i++)
    {
        $(useLis3[i]).on("click",function()
        {
            //alert($(this).index())

            if($(checkBox3.eq($(this).index())).attr("checked")==undefined)
            {
                $(checkBox3.eq($(this).index())).attr("checked",true);
                arr2.push($(checkBox3.eq($(this).index())).val());
            }else{
                $(checkBox3.eq($(this).index())).attr("checked",false);
                for(var j=0;j<arr2.length;j++)
                {
                    if(arr2[j]==$(checkBox3.eq($(this).index())).val())
                    {
                       arr2.splice(j,1);
                    }
                }
            }
            //alert(arr)
            str=arr2.join(',');
            //alert(str)
            $('#audienceids').val(str);
            //$(".checkOn").eq(0).val(1);
            //alert($(".checkOn").eq(0).val())

        })
    }
    //我承诺不违规的选择
    $(".i_promise").find("a").on("click",function()
    {
    	$(this).toggleClass("on");
    })

    //end write by whl



    //write by zjj
		//tab
		$(".tab").lt_tab({
			changeMode : "click",
			callBack:function(currentIndex){
				if(currentIndex == 1) {
					$('#tabradio').val(0);
				}
			}
		}); 
		$(function(){
			//选择标签
			//实用范围
			var way_content = $('.way_content .label_content li span');
			//应用层面
			var app_way = $('.app .label_content li span');
			//受众
			var person_way = $('.person_way .label_content li span');
			//参训人数
			var person_num = $('.person_num .label_content li span');

			function chooseRaido(obj,type){
				for(var i = 0; i < obj.length; i++){

					$(obj[i]).on('click',function() {
						if (type == 'radio') {
							if ($(this).hasClass('choose_obj')) {
								$(this).removeClass('choose_obj');
                                $(this).parents('ul').find("input").val('');
                                //alert("pppppppppppppppppppppppp")
								$(this).parents('ul').siblings('h3').css('color','#b0b0b0');
								$(this).parents('ul').siblings('h3').children('i').removeClass('label_on');
							}else{
								$(this).parents('ul').find('li').find('span').removeClass('choose_obj');
								$(this).addClass('choose_obj');	
								$(this).parents('ul').siblings('h3').css('color','#f55848');
								$(this).parents('ul').siblings('h3').children('i').addClass('label_on');
								var ridioIndex = $(this).parents('li').index();
								var ridioIndex = parseInt(ridioIndex) + parseInt(1);
								$(this).parents('ul').children('.ridioIndex').val(ridioIndex);
							}
						}else if(type == 'checkbox') {
                            if ($(this).hasClass('choose_obj')) {
                                $(this).removeClass('choose_obj');
                            }else{
                                $(this).addClass('choose_obj');
                                // $(this).parents('ul').siblings('h3').css('color','#f55848');
                                // $(this).parents('ul').siblings('h3').children('i').addClass('label_on');
                                // var ridioIndex = $(this).parents('li').index();
                                // var ridioIndex = parseInt(ridioIndex) + parseInt(1);
                                // $(this).parents('ul').children('.ridioIndex').val(ridioIndex);
                            }

						}
					});
				}
			}
			function titleColor(obj) {
				for (var i=0;i<obj.length;i++) {
					if($(obj[i]).hasClass('choose_obj')){
						$(obj[i]).parents('ul').siblings('h3').css('color','#f55848');
						$(obj[i]).parents('ul').siblings('h3').children('i').addClass('label_on');
						return;
					}else{
						$(obj[i]).parents('ul').siblings('h3').css('color','#b0b0b0');
						$(obj[i]).parents('ul').siblings('h3').children('i').removeClass('label_on');
					}
					
					
				};
			}
			var titleTimer = setInterval(function(){
								titleColor(way_content);
								titleColor(person_way);
							},100);

			//实用范围
			chooseRaido(way_content,'checkbox');
			//应用层面
			chooseRaido(app_way,'radio');
			//受众
			chooseRaido(person_way,'checkbox');
			//参训人数
			chooseRaido(person_num,'radio');
			//
			//清空输入框
			$('.title_content input').focus(function() {
				$(this).next().hide();
			});
			$('.title_content input').blur(function() {
				if ($(this).val() == '') {
					$(this).next().show();
				};
			});
			//清除定时器
			$('.btn_content').on('click',function(){
				window.clearInterval(titleTimer);
			})
		})	
		</script>